Basics

M:moveX(context.matrices, double a)

M:moveY(context.matrices, double a)

M:moveZ(context.matrices, double a)

M:translate(context.matrices, double x, double y, double z)

all of those change the position of an item or of the player hand, usage examples below:

if (I:isOf(context.item, Items:get("minecraft:enchanted_book"))) then
  M:moveX(context.matrices, -20)
  M:moveY(context.matrices, 0.04)
  M:moveZ(context.matrices, 0.15)
end
or, to be shorter
if (I:isOf(context.item, Items:get("minecraft:enchanted_book"))) then
  M:translate(context.matrices, -20, 0.04, 0.15)
end

M:rotateX(context.matrices, double a)

M:rotateY(context.matrices, double a)

M:rotateZ(context.matrices, double a)

all of those change the rotation of an item or of the hand, usage examples below:

if (I:isOf(context.item, Items:get("minecraft:enchanted_book"))) then
  M:rotateX(context.matrices, -20)
  M:rotateY(context.matrices, 34)
  M:rotateZ(context.matrices, 32.5)
end

M:scale(context.matrices, double x, double y, double z)

it will allow you to scale an item or the player hand, a number above 1 will make the item bigger, a value below 1 will make the item smaller

if (I:isOf(context.item, Items:get("minecraft:enchanted_book"))) then
  M:translate(context.matrices, 1.2, 1.2, 1.2)
end

M:pop(context.matrices)

delete the matrix, it should delete all the animations and positions of the packs below yours but at the time of writing^1 it just make the game crash

M:push(context.matrices)

Increment the stack pointer by one and set the values of the new current matrix to the one directly below it. i don’t really understand how this can be useful tbh

Advanced

this section of the wiki is the one i am more unsure of

M:sin(double a)

this can be used to add a sin curve to your animation

M:cos(double a)

this can be used to add a cos curve to your animation

M:clamp(double a, double min, double max)

it changed the starting value a in a range between min and max

M:floor(double a)

this function return the greatest integer less than or equal to the input value so, basically it’s just rounding down

input output
2.999 2
2.0001 2

M:ceil(double a)

this function return the least integer greater than or equal to the input value so, basically it’s just rounding up

input output
2.999 3
2.0001 3

M:round(double a)

so, basically it just round the number but i do not know the criteria lol

M:abs(double a)

this need to be described, the reason it was not described is the lack of infos, if you think to know how it works, please make a pull request it’s belived abs to be absolute value but since i am not sure i’il just not write about it until further research or a PR

M:lerp(double time, double start, double end)

it will allow to do lerping in animations, the object will move from start to end in a period defined by time

M:pow(double a, double b)

this allow you to do exponentiation, so it’s just a way to write $a^b$ in Lua code

back to index